<?php
/**
 * The default template for displaying content. Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage Sastro
 * @since Sastro 1.0
 */
 
 global $post, $more;
 $more = 0;
 $initial = THE_INITIAL;
?>

    <?php /* How to display all posts. */ ?>
	<article id="post-<?php the_ID(); ?>" <?php post_class("content-loop"); ?>>
    	<div class="stickybadge"></div>
		<?php
		if(!is_search()){
			$custom = get_post_custom($post->ID);
			$cf_exturl = (isset($custom["_".$initial."_external_url"][0]))? $custom["_".$initial."_external_url"][0] : "";
			
			if($cf_exturl){
				$exturl = $cf_exturl;
			}else{
				$exturl = get_permalink();
			}
		}
		?>
        <div class="loopcontainer">
    		<div class="entry-icon"><div class="fa fa-chain"></div></div>
       		<div class="entry-content">
                <a href="<?php echo esc_url($exturl); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', THE_LANG ), the_title_attribute( 'echo=0' ) ); ?>" data-rel="bookmark">
				<?php 
				if(is_search()){
					the_excerpt();
				}else{
					the_content(); 
				}
				?>
                </a>
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="entry-utility">
            <span class="meta-author"><?php _e('By', THE_LANG); ?> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) );?>"><?php the_author();?></a></span>&nbsp;&nbsp;/&nbsp;&nbsp;
            <span class="meta-date"><i class="fa fa-calendar"></i>&nbsp; <?php the_time('M d, Y') ?></span>&nbsp;&nbsp;/&nbsp;&nbsp;
            <span class="meta-cat"><i class="fa fa-folder-open"></i>&nbsp; <?php the_category(', '); ?></span>&nbsp;&nbsp;/&nbsp;&nbsp;
            <span class="meta-comment"><i class="fa fa-comments"></i>&nbsp; <?php comments_popup_link(__('0 Comment', THE_LANG), __('1 Comment', THE_LANG), __('% Comments', THE_LANG)); ?></span>
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
        <?php do_action('nvr_share_button'); ?>
		<div class="clearfix"></div>
        
	</article><!-- end post -->